import { http } from '@/utils';

export const getUserInfo = () => {
  return async (dispatch, getState) => {
    const token = getState().login;

    // 发送请求
    const res = await http.get('/user/profile');

    // console.log('userinfo res', res)
    // 同步action
    // dispatch action
    dispatch({
      type: 'user/getUserInfo',
      payload: res.data.data,
    });
  };
};
